<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}


-->
</style></head>
<body>
<!-- #####imgshow 开始#### -->
<style type="text/css">
.showpic  {
	list-style-type:none;
	padding:0;
	margin:0;
}
.showpic li {
	float:left;
	text-align:center;
	font-size:12px;
}
.showpic img{
	border:1px solid #ccc;
	padding:1px;
	width:100px;
	height:80px;
	margin:10px 5px;
}
</style>
<!--
value 格式： a.jpg@b.jpg@c.jpg@

-->
<input id="picURL" type="text" value="img201011150649523343109.jpg@img201011150649533084106.jpg@img201011150649534964141.jpg@" size="100" />
<div id="display"></div>

<script type="text/javascript">
<!--
/*
	* 去掉最后一个字符串
	abc：待处理的字符串
*/
function delend(abc)
{
	var abclen = abc.length;
	return abc.substring(0,abclen - 1);
}
/*
	* 删除图片路径
	oid : 对象的ID
	imgurl:需要清除的字符串  如img201011150649523343109.jpg
*/
function delimgurl(oid,imgurl)
{
	if(confirm('确定删除！'))
	{
		var a = document.getElementById(oid).value;
		var b = imgurl + "@";
		c=a.replace(b,"");  
		document.getElementById(oid).value = c;
		showupimg("picURL","display");
		return true;
	}
	else 	return false;
}
/*
	* 显示图片
	inid : 内容的 ID
	outid: 用于显示的div id
*/
function showupimg(inid,outid)
{
	var imgurl = document.getElementById('picURL').value;
	if ( imgurl !="")
	{ 
		var picstr = delend(imgurl);
		var pic_url_head = "http://img.jiaju369.com/jiaju369img/user/";
		var brands = new Array(); //创建数组
		var dtNum = picstr.split("@").length; //取得字符串长度
		brands = picstr.split("@"); //为数组负值
		outstr = "<ul class=\" showpic\">";
		for (i = 0; i < dtNum; i++) {
			outstr += "<li>";
			outstr += "<img src=\""+ pic_url_head + brands[i] +"\"/><br />"; //打印
			outstr += "<input onclick=\"delimgurl('picURL','"+ brands[i] +"')\" type=\"button\" value=\"删除\" />";
			outstr += "</li>";
		}
		outstr += "</ul>";
		document.getElementById(outid).innerHTML = outstr;
	}else document.getElementById(outid).innerHTML="";
	
}


/*
	调用：显示图片
*/

showupimg("picURL","display");


-->
</script>
<!--### imgshow 结束### -->
</body>
</html>
